import http from '@/util/http.js'
export default {
  namespaced: true,
  state: {
    datalist: [],
    predatalist: [],
    pathlist: [],
  },
  mutations: {
    pushDatalist(state, products) {
        console.log(products)
      state.datalist.push(...products)
    },
    pushPredatalist(state, products) {
      state.predatalist.push(...products)
    },

    pushPathlist(state, path) {
      state.pathlist.push(path)
    }
  },
  actions: {
    pushDatalist(context, path) {
      http.get(path).then(res => {
        //   console.log(res.data.children)
        context.commit("pushDatalist", res.data.children)

      })
    },
    pushPredatalist(context, path) {
      http.get(path).then(res => {

        console.log(res.data)

        context.commit("pushDatalist", res.data.goods_list)
      })

    },

    getpushPathlist(context, path) {
      console.log(path)

      context.commit("pushPathlist", path)
    }
  }
}
